package educar.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.LayoutManager;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.EmptyBorder;

//import com.jgoodies.forms.factories.CC;
import educar.controllers.ActividadControllerDoc;
import educar.controllers.DatosActController;
import educar.controllers.DatosController;
import educar.controllers.IController;
import educar.controllers.LoginController;
import educar.models.Session;

public class DatosActView extends JPanel implements IView {
	private JFrame jfWindow;
	JLabel label1;
	JTextField textField1;
	 JLabel label2;
 JTextField textField2;
 static String nombreMat="";	 
	 JButton button1;

	public DatosActView() {
		jfWindow = new JFrame();
		Container container = jfWindow.getContentPane();

		setupMainContainer(container);

		jfWindow.pack();
		jfWindow.setVisible(true);
		jfWindow.setResizable(false);
		jfWindow.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
	}

	private void setupMainContainer(Container container) {
		container.setLayout((LayoutManager) new BoxLayout(jfWindow
				.getContentPane(), BoxLayout.Y_AXIS));

		((JComponent) container).setBorder(new EmptyBorder(0, 50,50, 50));

		JLabel lblWelcome = new JLabel(" Ingrese");
		lblWelcome.setAlignmentX(Component.CENTER_ALIGNMENT);
		lblWelcome.setFont(new Font("Serif", Font.BOLD, 16));
		lblWelcome.setBorder(new EmptyBorder(10, 10, 10, 10));
		container.add(lblWelcome);

		// Lay out the buttons from left to right.
		JLabel label1 = new JLabel("Nombre de la actividad :");    
		textField1 = new JTextField(20);
		JPanel usernamePane = new JPanel();
		usernamePane.setLayout(new BoxLayout(usernamePane, BoxLayout.LINE_AXIS));
		usernamePane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
		usernamePane.add(Box.createHorizontalGlue());
		usernamePane.add(label1);
		
		usernamePane.add(Box.createRigidArea(new Dimension(10, 0)));
		usernamePane.add(label1);
		usernamePane.add(textField1);
		container.add(usernamePane);

	  
			  
		
		//---- button1 ----
				
		JButton bacep = new JButton("ACEPTAR");
	bacep.setAlignmentX(Component.RIGHT_ALIGNMENT);
		container.add(bacep);
		
	LoginListener buttonListener = new LoginListener();
	IController loginController = new ActividadControllerDoc();
	loginController.setView(this);
	buttonListener.associate(bacep, loginController);

	}
	
	
	 public String getNombreAct() {
         return textField1.getText().trim();
 }
	 
	

	  
	 
	 
	 public void present(String model) {
			JOptionPane.showMessageDialog(null, model);
		}
	 
	 public String getMatSeleccionada(){
		 DocenteActView doc = new DocenteActView();
         nombreMat = doc.getMateria();
         return nombreMat;
		 
	 }
	 


	
	public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
				try {
					UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
				} catch (Exception ex) {
					// ignore
				}
               javax.swing.JFrame frame = new javax.swing.JFrame("Datos");
                frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
                frame.getContentPane().add(new DatosActView());
                frame.pack();
                frame.setVisible(false);
                
             
            }
        });
    }
}